package com.grace.storage.utils;

import java.awt.image.BufferedImage;

public class ImageValidationUtils {
    
    // 验证图片尺寸
    public static void validateImageDimensions(BufferedImage image, int maxWidth, int maxHeight) 
            throws InvalidImageDimensionException {
        if (image.getWidth() > maxWidth || image.getHeight() > maxHeight) {
            throw new InvalidImageDimensionException(
                String.format("图片尺寸不得超过 %dx%d", maxWidth, maxHeight));
        }
    }
    
    // 自定义异常
    public static class InvalidImageDimensionException extends Exception {
        public InvalidImageDimensionException(String message) {
            super(message);
        }
    }
}
